package com.toprs.base.config

import com.toprs.base.annotation.Slf4j2
import com.toprs.base.annotation.Slf4j2.Companion.log
import jakarta.annotation.PostConstruct
import org.apache.commons.lang3.ClassUtils
import org.apache.ibatis.logging.stdout.StdOutImpl
import org.slf4j.LoggerFactory
import org.springframework.core.annotation.Order
import org.springframework.core.io.ClassPathResource
import org.springframework.stereotype.Component
import org.springframework.util.ResourceUtils
import java.io.File
import java.util.logging.Logger

@Component
class GlobalCurrent {


    @PostConstruct
    fun post() {

        val log = LoggerFactory.getLogger(StdOutImpl::class.java)


        val logo =
            "\n" + " _________    ___   _______  _______     ______   \n" + "|  _   _  | .'   `.|_   __ \\|_   __ \\  .' ____ \\  \n" + "|_/ | | \\_|/  .-.  \\ | |__) | | |__) | | (___ \\_| \n" + "    | |    | |   | | |  ___/  |  __ /   _.____`.  \n" + "   _| |_   \\  `-'  /_| |_    _| |  \\ \\_| \\____) | \n" + "  |_____|   `.___.'|_____|  |____| |___|\\______.'  " + "          is loaded.\n"

        log.info(logo)

        System.setProperty("pagehelper.banner", false.toString())
        setDataPath()
    }


    companion object {
        var dataPath: String = ""

        fun setDataPath() {
            dataPath = File(ResourceUtils.getURL("").path).absolutePath + File.separator
            println(dataPath)
        }

    }


}